/*
 * @Author: Leo.wang wanglizhigs@163.com
 * @Date: 2023-12-25 21:46:29
 * @LastEditors: Leo.wang wanglizhigs@163.com
 * @LastEditTime: 2023-12-25 22:13:05
 * @FilePath: /ruoyi-ui/src/filter/date.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export function transformOptions(
  list,
  { target = 'name', isCount = true, hasEmpty = false } = {}
){
  const options = list.map(
    (item) =>
    ({
      value: item.id,
      label: `${item[target]}`,
    }),
  );

  if (hasEmpty) {
    return [{ value: '', label: '无' }, ...options]
  } else {
    return options
  }
}
